package it.antonio.ilpizze.db.index.btree.memory;


import it.antonio.ilpizze.db.index.btree.AbstractBTree;
import it.antonio.ilpizze.db.index.btree.Entry;
import it.antonio.ilpizze.db.index.btree.IntermediateNode;
import it.antonio.ilpizze.db.index.btree.LeafNode;



public class MemoryBTree<K extends Comparable<K>,V> extends AbstractBTree<K,V>{
	
	// massimo numero di figli per nodo

	private static final int M = 4;
	
	private int degree;
	
	public MemoryBTree(int degree) {
		this.degree = degree;
		
	}

	public MemoryBTree() {
		this(M);
	}
	
	
	@Override
	protected int degree() {
		return degree;
	}

	@Override
	protected Entry<K, V> createEntry(K key, V value) {
		return new MemoryEntry<K,V>(key, value);
	}

	@Override
	protected IntermediateNode<K, V> createIntermediateNode(K key, int maxKeys) {
		return new MemoryIntermediateNode<K, V>(key, maxKeys);
	}

	@Override
	protected LeafNode<K, V> createLeafNode(K key, int maxKeys) {
		return new MemoryLeafNode<K, V>(key, maxKeys);
	}

	@Override
	protected IntermediateNode<K, V> createRootNode(K key, int maxKeys) {
		return new MemoryIntermediateNode<K, V>(key, maxKeys);
	}

	

}
